package com.wbt.bambootown.ui.adapter;


import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.wbt.bambootown.R;
import com.wbt.bambootown.entity.CameraPic;
import com.wbt.bambootown.entity.ControlLog;
import com.wbt.bambootown.ui.view.recyclerview.BaseAdapter;
import com.wbt.bambootown.ui.view.recyclerview.BaseViewHolder;
import com.zhy.autolayout.utils.AutoUtils;


/**
 * Created by wufan on 2018/5/16.
 */

public class ControlLogAdapter extends BaseAdapter<ControlLog, BaseViewHolder>{

    private Context context;

    public ControlLogAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public BaseViewHolder createCustomViewHolder(ViewGroup parent, int viewType) {
        return new BaseViewHolder(parent , R.layout.item_control_log);
    }

    @Override
    public void bindCustomViewHolder(final BaseViewHolder viewHolder, final int position) {
        AutoUtils.autoSize(viewHolder.itemView);

        final ControlLog item = getItem(position);
        viewHolder.getTextView(R.id.tv_createTime).setText(item.getCreateTime());
        //0未执行  1正在执行  2已执行
        viewHolder.getTextView(R.id.tv_cmdStatus).setText(item.getCmdStatus() == 0 ? "未执行" : (item.getCmdStatus() == 1 ? "正在执行" : "已执行"));
        viewHolder.getTextView(R.id.tv_cmdResult).setText(item.isSuccess() ? "成功" : "失败");
        viewHolder.getTextView(R.id.tv_updateTime).setText(item.getUpdateTime());
        viewHolder.getTextView(R.id.tv_costTime).setText(item.getCosttime() + "");
        viewHolder.getTextView(R.id.tv_actionTimes).setText(item.getActionTimes() + "");
        viewHolder.getTextView(R.id.tv_source).setText(item.getSource());

    }

    @Override
    public int getCustomViewType(int position) {
        return 0;
    }
}
